package com.demo;

import java.util.HashMap;
import java.util.Map;

/*
 * 实例工厂方法：实例工厂的方法。先需要创建工厂本身，再调用工厂的实例方法来返回bean的实例
 */
public class InstanceAddressFactory {
	private Map<String, Address> addresses=null;
	
	public InstanceAddressFactory(){
		addresses=new HashMap<>();
		addresses.put("first", new Address("beijing", "中南海"));
		addresses.put("second", new Address("yunan", "昆明"));
	}
	
	public Address getAddresses(String order){
		return addresses.get(order);
	}
}
